package cn.zyy.hotel.controller.admin;

import cn.zyy.hotel.utils.SystemConstant;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;


//负责跳转页面(后台管理页面)
@Controller
@RequestMapping("/admin")
public class SystemController {

    //跳转登录页面
    @RequestMapping("/login.html")
    public String login(){
        return "admin/login";
    }

    //跳转后台首页
    @RequestMapping("/home.html")
    public String home(){
        return "admin/home";
    }

    //退出登录
    @RequestMapping("/logout")
    public String logout(HttpSession session){
        //清空session
        session.removeAttribute(SystemConstant.LOGINUSER);
        Subject subject = SecurityUtils.getSubject();
        subject.logout();
        //重定向到登录页面
        return "redirect:/admin/login.html";
    }

    //跳转部门管理页面
    @RequiresPermissions("sys:dept")
    @RequestMapping("/toDeptManager")
    public String toDeptManager(){
        return "admin/dept/deptManager";
    }

    //跳转角色管理页面
    @RequiresPermissions("sys:role")
    @RequestMapping("/toRoleManager")
    public String toRoleManager(){
        return "admin/role/roleManager";
    }

    //跳转员工管理页面
    @RequiresPermissions("sys:emp")
    @RequestMapping("/toEmployeeManager")
    public String toEmployeeManager(){
        return "admin/employee/employeeManager";
    }

    //跳转菜单管理页面
    @RequiresPermissions("sys:menu")
    @RequestMapping("/toMenuManager")
    public String toMenuManager(){
        return "admin/menu/menuManager";
    }

    //跳转楼层管理页面
    @RequiresPermissions("sys:floor")
    @RequestMapping("/toFloorManager")
    public String toFloorManager(){
        return "admin/floor/floorManager";
    }

    //跳转房型管理页面
    @RequiresPermissions("sys:roomtype")
    @RequestMapping("/toRoomTypeManager")
    public String toRoomTypeManager(){
        return "admin/roomType/roomTypeManager";
    }

    //跳转房间管理页面
    @RequiresPermissions("sys:room")
    @RequestMapping("/toRoomManager")
    public String toRoomManager(){
        return "admin/room/roomManager";
    }

    //跳转预定管理页面
    @RequiresPermissions("sys:order")
    @RequestMapping("/toOrdersManager")
    public String toOrdersManager(){
        return "admin/orders/ordersManager";
    }

    //跳转入住管理页面
    @RequiresPermissions("sys:checkin")
    @RequestMapping("/toCheckinManager")
    public String toCheckinManager(){
        return "admin/checkin/checkinManager";
    }

    //跳转年度营业额报表统计分析页面
    @RequiresPermissions("sys:year")
    @RequestMapping("/toYearTotalPriceManager")
    public String toYearTotalPriceManage(){
        return "admin/charts/yearTotalPriceCharts";
    }

    //跳转月营业额报表统计分析页面
    @RequiresPermissions("sys:month")
    @RequestMapping("/toYearOfMonthCharts")
    public String toYearOfMonthCharts(){
        return "admin/charts/yearOfMonthCharts";
    }

    //跳转季度营业额报表
    @RequiresPermissions("sys:quart")
    @RequestMapping("/toQuarterTotalPriceCharts")
    public String toQuarterTotalPriceCharts(){
        return "admin/charts/quarterTotalPriceCharts";
    }

    //跳转房型预订报表统计分析页面
    @RequiresPermissions("sys:typechars")
    @RequestMapping("/toRoomTypePieCharts")
    public String toRoomTypePieCharts(){
        return "admin/charts/roomTypePieCharts";
    }

    //跳转当日开房报表
    @RequiresPermissions("sys:day")
    @RequestMapping("/toCurrentDateCheckinCharts")
    public String toCurrentDateCheckinCharts(){
        return "admin/charts/currentDateCheckinCharts";
    }

    //跳转员工修改密码页面
    @RequestMapping("/toEmployeePwd")
    public String toEmployeePwd(){
        return "admin/employeePwd";
    }

    //跳转首页轮播图管理界面
    @RequiresPermissions("sys:carousel")
    @RequestMapping("/toCarousel")
    public String toCarousel(){
        return "admin/carousel/carousel";
    }

    //跳转首页
    @RequestMapping("/desktop")
    public String desktop(){
        return "admin/desktop";
    }

    //跳转公告管理
    @RequiresPermissions("sys:notice")
    @RequestMapping("/toNotice")
    public String toNotice(){
        return "admin/notice/notice";
    }


}
